package design_pattern.proxy_pattern.static_proxy;

/**
 * @author Cheng Jun @Description: 包租婆
 * @version 1.0
 * @date 2022/7/20 17:13
 */
public class Landlady implements LandLord {
    // 租金，低于 RENT_MONEY 的话，租房失败
    private static int RENT_MONEY = 100;
    private String name;

    public Landlady(String name) {
        this.name = name;
    }

    /**
     * @param rentMoney 租金
     * @return java.lang.String 返回 success，表示出租成功
     * @author Cheng Jun
     * @date 2022/7/20 17:11
     */
    @Override
    public String rentHouse(int rentMoney) {
        System.out.println("我是房东:" + name);
        if (rentMoney < RENT_MONEY) {
            System.out.println("租房失败");
            return "fail";
        } else {
            System.out.println(name + "说-租房成功，有任何问题和我说，我给你解决");
            return "success";
        }
    }

    public void shopping(){
        System.out.println("我是：" + name + "，正在 shopping");
    }
    private String sayName(){
        System.out.println("我是：" + name);
        return this.name;
    }
}
